package nxu.it.dao.Impl;

import nxu.it.dao.JdbiFactory;
import nxu.it.dao.RegisterDao;
import nxu.it.dao.RegisterStorage;
import nxu.it.dao.TodoDao;
import nxu.it.model.RegisterRequest;
import org.jdbi.v3.core.Jdbi;

public class JdbiRegisterStorage implements RegisterStorage {
    private static final Jdbi JDBI = JdbiFactory.getJdbi();
    @Override
    public Boolean submit(RegisterRequest registerRequest) {
        return JDBI.withExtension(RegisterDao.class, dao->{
            try{
                dao.submit(registerRequest);
            }catch (Exception e){
                return false;
            }
            return true;
        });
    }
}
